package com.hdl.client.listener;

import com.hdl.client.consumer.ServiceDiscover;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import java.sql.Ref;

/**
 * 类名 NettyClientStartListener
 * 描述 TODO
 *
 * @author hedonglin
 * @version 1.0
 * @date 2020/6/17 17:24
 */
@Component
public class NettyClientStartListener implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    private ServiceDiscover serviceDiscover;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        serviceDiscover.watchNode(ServiceDiscover.SERVICE_PROVIDER);
    }
}
